<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>采购退货审核</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${Plugins}/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/datepicker/WdatePicker.js" type="text/javascript"></script>
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>
<script src="${BasePath}/res/js/common/jquery.form.js" type="text/javascript"></script>
<style type="text/css">
#searchbar{
	margin-bottom: 10px;
}
.navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
.l-button-search{
	width: 50px;
	margin-left: 10px;
	padding-bottom: 2px;
	display: inline;
}
</style>
</head>
<body style="padding:6px; overflow:hidden;">
<div id="">
	<div class="navbar"><span>您当前的位置：采购管理 &gt;采购退货管理 &gt;采购退货审核 </span></div>
	<br/>
	<form action="poAudit.do"  name="queryForm" id="queryForm" method="POST">
		<input type="hidden" id="puNo" name="puNo" value="${purchase.puNo}">
		<table  width = "100%" cellpadding="0" cellspacing="0" class="l-table-edit" style="TABLE-LAYOUT: fixed">
		     <tr height="30">
			     <td class="l-table-edit-td">&nbsp;采购退货单号：${purchase.puNo }</td>
		         <td class="l-table-edit-td">&nbsp;采购单号：${purchase.poNo }</td>
		         <td class="l-table-edit-td">&nbsp;创建人：${purchase.creater }</td>
		     </tr>
		     <tr height="30">
		        <td class="l-table-edit-td">&nbsp;创建时间：${purchase.createTime}</td>
		        <td class="l-table-edit-td">&nbsp;采购单退换货状态：
					<c:choose>
	        		<c:when test="${purchase.status == 0 }">
	        			待审核
	        		</c:when>
	        		<c:when test="${purchase.status == 1 }">
	        			已审核
	        		</c:when>
	        		<c:when test="${purchase.status == 2 }">
	        			采购中
	        		</c:when>
	        		<c:when test="${purchase.status == 3 }">
	        			入库中
	        		</c:when>
	        		<c:when test="${purchase.status == 4 }">
	        			采购完成
	        		</c:when>
	        		<c:otherwise>
	        			&nbsp;
	        		</c:otherwise>
	        	</c:choose>
				</td>
				
		        <td class="l-table-edit-td">&nbsp;审核流程：
					<c:choose>
	        		<c:when test="${purchase.curAuditPoint == 1 }">
	        			待采购主管处理
	        		</c:when>
	        		<c:when test="${purchase.curAuditPoint == 99 }">
	        			已结束流程
	        		</c:when>
	        		<c:otherwise>
	        			&nbsp;
	        		</c:otherwise>
	        	</c:choose>
				</td>
			
		     </tr>
		   
	        <tr height="30">
			    <tr>
			    	<td class="l-table-edit-td"><font  color="red">*&nbsp;</font>审核状态：&nbsp;&nbsp;
			           <input type="radio" checked="checked" id="auditAgree" name="auditResult" size="18" maxLength="40" value="1">
			                                 通过&nbsp;&nbsp;
			           <input type="radio" id="auditDisagree" name="auditResult" size="18" maxLength="40" value="2">
			                                 不通过
			        </td>
			    </tr>
			    <tr height="30"></tr>
			    <tr>
			        <td class="l-table-edit-td" colspan="2" align="left">
			        	<font  color="red">*&nbsp;</font>审核意见：<textarea cols="100" rows="7" class="l-textarea" id="remark" name="remark" ></textarea>
			        </td>
			    </tr> 
		</table>
		<br>
		<input  type="submit" value="保存" class="l-button-search" style="margin-left: 730px;">&nbsp;&nbsp;&nbsp;&nbsp;<input  type="button" id="tests" value="取消" class="l-button-search" >
	</form>
	<br/>
</div>
<div id="maingrid6" style="margin:0; padding:0"></div>
  <div style="display:none;">
  <!-- g data total ttt -->
</div>
<script type="text/javascript">

// 取消
$("#tests").click(function() {
	close_liger_tab();
});
/***********************************显示商品列表************************************/
 var grid6 = null;
    var showList = "${showList}";
    $(function () {
     
   	  var columns = [
 	            { display: '货品编码', name: 'prodNo', align: 'left', width: '10%' },
 	            { display: '商品名称', name: 'commodityName', width: '12%',},
 	            { display: '箱包装规格', name: 'specification', width: '8%' },
 	            { display: '供应商名称', name: 'supName', width: '10%'},
 	            { display: '仓库名称', name: 'purWhName', width: '8%',},
 	            { display: '数量', name: 'yieldAmountNumner', width: '8%', },
 	            { display: '单价', name: 'purUnitPrice',align: 'left', width: '8%',  },
 	            { display: '金额', name: 'totalPrice', width: '8%', }
 	            ];
   	grid6 = $("#maingrid6").ligerGrid({
        columns: columns, 
        pageSize: 30,
        width: '100%',
        height: '100%',
        dataType: 'server', 
        dataAction: 'server',
        pagesizeParmName: 'pageSize',
        parms: [
                {name: "puNo", value:'${purchase.puNo }' }
        	],
        url: "ajaxToPoProductList.do"
    });
    	  
        
    });
    
    
/**/


 var basePath = "${BasePath}";
$(function ()
		{
			//validate
		    $.metadata.setType("attr", "validate");
		    var v = $("form").validate({
		    	rules: {
		    		"remark": {required: true,rangelength:[2,50]}
		    	},
		    	messages: {
		    		"remark": {
		    			required: "该字段不能为空",
		    			rangelength: jQuery.validator.format("请输入{0}-{1}位字符")
		    		}
		    	},
		        errorPlacement: function (lable, element)
		        {
		        	lable.ligerHideTip();
		            if (element.hasClass("l-textarea"))
		            {
		                element.ligerTip({ content: lable.html(), target: element[0] }); 
		            }
		            else if (element.hasClass("l-text-field"))
		            {
		                element.parent().ligerTip({ content: lable.html(), target: element[0] });
		            }
		            else
		            {
		                lable.appendTo(element.parents("td:first").next("td"));
		            }
		        },
		        success: function (lable)
		        {
		            lable.ligerHideTip();
		            lable.remove();
		        },
		        submitHandler:function()
		        {
		            $("form .l-text,.l-textarea").ligerHideTip();
		            var options = {
		            		type: 'POST',
		            		success: function(data){
		            			if(!data || data.toLowerCase() == "fail") {
		            				var er = $.ligerDialog.error("操作失败", function(yes) {
		            					if (yes) {
		            						window.parent.location.href = "../../../system/main/mainFrame.do";
		            					}
		            				});
		            				$(er.dialog.winbtns).remove();
		            				//parent.window.location.reload();
		            			} else if(data.toLowerCase() == "success") {
		            				
		            				window.parent.f_tip('操作成功');
		           					close_liger_tab();
		            			} else {
		            				var er = $.ligerDialog.error("操作失败", function(yes) {
		            					if (yes) {
		            						window.parent.location.href = "../../../manager/purchase/orders/poList.do";
		            					}
		            				});
		            				$(er.dialog.winbtns).remove();
		            				//parent.window.location.reload();
		            			}
		            			
		            		}
		            	}, $form1 = $("#queryForm");
		           $form1.ajaxSubmit(options);
		             return false;
		        }
		    });
		}); 
// 取消
$("#cancelButton").click(function() {
	window.parent.location.href = "../../../manager/purchase/orders/poList.do";
	//parent.window.location.reload();
});
</script>
</body>
</html>